#include "Student.h"



Student::Student()
{
}

Student::Student(int id, string name, string username, string password, string major, string clazz)
	:User(id,name,username,password)
{
	this->major = major;
	this->clazz = clazz;
}


Student::~Student()
{
}

string Student::getClazz()
{
	return clazz;
}

string Student::getMajor()
{
	return major;
}

map<int, Course*>& Student::getCourses()
{
	return courses;
}

map<int, ScoreRecord>& Student::getScores()
{
	return scores;
}

void Student::setClazz(string clazz)
{
	this->clazz = clazz;
}

void Student::setMajor(string major)
{
	this->major = major;
}

void Student::addScore(int id, ScoreRecord score)
{
	scores[id]=score;
}


void Student::addCourse(Course* course)
{
	courses[course->getId()] = course;
}

void Student::deleteCourseById(int courseId)
{
	map<int, Course*>::iterator it = courses.find(courseId);
	if (it != courses.end())
		courses.erase(it);

	map<int, ScoreRecord>::iterator itt = scores.find(courseId);
	if (itt != scores.end())
		scores.erase(itt);


}

